import type {PageParam, PageResult} from '@vben/request';
import type {Dayjs} from 'dayjs';

import {requestClient} from '#/api/request';
export namespace PerPartTimeApi {
  /** 兼职情况信息 */
  export interface PartTime {
    id: number; // 主键ID
    employeeId?: number; // 人员ID，对应 per_employee.id
    organizationName: string; // 社会兼职单位名称
    organizationType: string; // 单位性质
    position: string; // 担任职务
    paymentStatus: string; // 取酬情况
    partTimeDate: string | Dayjs; // 兼职时间
    approvedDepartment: string; // 批准部门
    status: number; // 记录状态（1：有效，0：无效）
    remarks: string; // 备注
  }
}

/** 查询兼职情况分页 */
export function getPartTimePage(data: PageParam,desensitize: boolean,encrypt: boolean) {
  return requestClient.post<PageResult<PerPartTimeApi.PartTime>>('/per/part-time/page', data,{ desensitize,encrypt });
}

/** 查询兼职情况详情 */
export function getPartTime(id: number) {
  return requestClient.get<PerPartTimeApi.PartTime>(`/per/part-time/get?id=${id}`);
}

/** 新增兼职情况 */
export function createPartTime(data: PerPartTimeApi.PartTime) {
  return requestClient.post('/per/part-time/create', data);
}

/** 修改兼职情况 */
export function updatePartTime(data: PerPartTimeApi.PartTime) {
  return requestClient.put('/per/part-time/update', data);
}

/** 删除兼职情况 */
export function deletePartTime(id: number) {
  return requestClient.delete(`/per/part-time/delete?id=${id}`);
}

/** 批量删除兼职情况 */
export function deletePartTimeList(ids: number[]) {
  return requestClient.delete(`/per/part-time/delete-list?ids=${ids.join(',')}`)
}

/** 导出兼职情况 */
export function exportPartTime(params: any) {
  return requestClient.download('/per/part-time/export-excel', { params });
}
